<template>
  <div>
    <!-- 自定义导航栏 -->
    <gh-navbar id="navbar" :showback="true" title="付费咨询" url="/pages/my/my" />
    <div class="none" v-show="condition">
      <image class="none-img" :src="imgBaseUrl + 'none.png'" mode="widthFix" />
    </div>
    <gh-pay-item :dataList="dataList" :type="1" />
  </div>
</template>
<script>
export default {
  data() {
    return {
      dataList: [],
      page: 1,
      length: 0,
      imgBaseUrl: this.$store.state.imgBaseUrl,
      condition: false
    };
  },
  onShow() {
    // 先清空数据再重新获取新数据
    this.dataList = []
    this.init();
  },
  methods: {
    async init(page = 1) {
      let res = await this.$gh
        .request("member.order", {
          data: {
            op: "getOrderList",
            service_type: '1',
            page,
            psize: 20
          }
        })
        .catch(err => {
          if (err.code == 41009) {
            this.$store.dispatch("login", err.message);
          }
          if(err.code == 201){
            this.condition = true
          }
        });
      this.dataList = this.dataList.concat(res.data.list)
      this.length = res.data.list.length;
    }
  },
  onReachBottom(){
    if (this.length < 20) return;
    this.page++;
    this.init(this.page);
  }
};
</script>
<style lang='less' scoped>
@import url("../../common/util.less");
.none {
  font-size: 30rpx;
  color: @font-color;
  text-align: center;
  .none-img{
    width: 50%;
    margin-top: 100rpx;
  }
}
</style>